package com.library.control.user;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.library.model.dto.user.UserDTO;
import com.library.model.service.UserService;

public class UserListController extends AbstractController{

	private UserService userservice;
	
	public void setUserservice(UserService userservice) {
		this.userservice = userservice;
	}

	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		ModelAndView mav=new ModelAndView();
		List<UserDTO> list=new ArrayList<UserDTO>();
		list=userservice.getAllUser();
		mav.addObject("users",list);
		mav.setViewName("userlist");
		return mav;
	}

}
